package com.bjsxt.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bjsxt.domain.UserAddress;
import com.bjsxt.mapper.UserAddressMapper;
import com.bjsxt.service.UserAddressService;
import org.springframework.stereotype.Service;

@Service
public class UserAddressServiceImpl extends ServiceImpl<UserAddressMapper, UserAddress> implements UserAddressService {

    /**
     * 根据用户 id 分页查询钱包地址数据
     *
     * @param page   分页对象<UserAddress>
     * @param userId 用户 id
     * @return 统一响应对象
     */
    @Override
    public Page<UserAddress> pageByUserId(Page<UserAddress> page, Long userId) {
        // 根据对应的条件进行分页数据的查询并返回
        return page(page, new LambdaQueryWrapper<UserAddress>()
                .eq(UserAddress::getUserId, userId)
        );
    }
}
